package com.lry.pda.topdown;


import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Symbols {

    //表达式左边
    public int symbol;

    public boolean nullable;

    //表达式右边，因为表达式右边可能有多个或者关系，所以是list
    public List<int[]> productions;

    //first集合，首符集
    public Set<Integer> firstSet = new HashSet<>();

    //follow集合，随符集
    public Set<Integer> followSet = new HashSet<>();

    //和productions,productNums一一对应
    public List<Set<Integer>> selectSet = new ArrayList<>();

    public List<Integer> productNums;

    public Symbols(int symbol,boolean nullable,List<int[]> productions,List<Integer> productNums){
        this.productNums = productNums;
        this.symbol = symbol;
        this.nullable = nullable;
        this.productions = productions;

        if(symbol< SymbolDefine.STMT){
            //终结符的首符集是自己
            this.firstSet.add(symbol);
        }
    }

}
